package uk.org.landeg.euler.problems.unported;

import java.math.BigInteger;

public class Euler057 {
	public static void main(String[] args) {
		System.out.println(solve());
	}

	public static Object solve() {
		BigInteger n0,n1,n2;
		BigInteger d0,d1,d2;
		BigInteger two;
		n2 = BigInteger.valueOf(3);
		n1 = BigInteger.valueOf(7);
		d1 = BigInteger.valueOf(5);
		d2 = BigInteger.valueOf(2);
		two = BigInteger.valueOf(2);
		int count = 0;
		for (int itt = 2 ; itt <= 1000 ; itt++) {
			n0 = n1.multiply(two).add(n2);
			d0 = d1.multiply(two).add(d2);
			n2 = n1; d2 = d1;
			n1 = n0; d1 = d0;
			if (n0.toString().length() > d0.toString().length()) {
				count++;
			}
		}
//		out.println("Done : " + count);
		return count;
	}
}
